import VueRouter from "vue-router";
import Login from "./components/Login.vue"
import Register from "./components/Register.vue";
let router=new VueRouter({
    //开启了history模式后，不能通过./register类似的路由地址访问
    mode:"history",
    linkActiveClass:'my-active',
    linkExactActiveClass:'my-exact-active',
    routes:[
        {
            path:"/",
            redirect:"/login"
        },
        {
            path:"/login",
            component:Login,
            meta:{title:"login"}
        },
        {
            path:"/register",
            component:Register,
            meta:{title:"register"}
        }
    ]
})
router.beforeEach((to,from,next)=>{
    if (to.meta.title){
        document.title=to.meta.title
    }
    next()
})
export default router